﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DB
{
    class DatabaseCommand
    {
        private readonly DatabaseConnection dbConnection;
        private readonly string sqlRequest;

        public DatabaseCommand(DatabaseConnection connection, string sql)
        {
            if (dbConnection == null)
                throw new InvalidOperationException("db connection was not determine");
            dbConnection = connection;

            if (String.IsNullOrWhiteSpace(sql))
                throw new InvalidOperationException("sql-request is empty");
            sqlRequest = sql;
        }

        public void Execute()
        {
            dbConnection.OpenConnection();
            Console.WriteLine("SQL: {0}", sqlRequest);
            dbConnection.CloseConnection();
        }
        

    }
}
